Clear command line output from Python [Eclipse]
Posted
by Tomas Lycken
on Stack Overflow
See other posts from Stack Overflow
or by Tomas Lycken
Published on 2010-03-18T00:25:00Z
Indexed on
2010/03/18
0:31 UTC
Read the original article
Hit count: 345
I'm using Eclipse for writing Python, and I want to be able to easily clear the screen. I've seen this question, and tried (among other things suggested there) the following solution
import os
def clear():
os.system('cls' if os.name == 'nt' else 'clear')
but it doesn't entirely solve my problem. Instead of clearing the screen, the routine prints a small square (as if wanting to print an unknown character) to the command output window in Eclipse.
Typing cls
in the command line works perfectly fine, as does running a Python script with the above code from command line. But how can I make it look nice in Eclipse as well?
© Stack Overflow or respective owner